Page({

    /**
     * 页面的初始数据
     */
    data: {
      isGoBottom:false,
      pagedefault:1,
      options: ['大陆', '长沙', '株洲', '北京'],
      LogsType:['发现','徒步','看海','玩乐','酒店','美食','测试'],
      time: '2024-07-08',
      default: 0,
      activeLeft: 0,
      currentImgIndex: 0, // 当前图片索引
      LogsShowType:true,
      img:[
          {url:"https://pages.c-ctrip.com/livestream/ugcBook/user_double.png"},
          {url:"https://pages.c-ctrip.com/livestream/ugcBook/use_single.png"}
      ],
      logsItem: [
        {
          "systemType": "admin",
          "image": "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg",
          "images":[
            "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
            "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
            "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
            "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg"
          ],
          "type": "images",
          "position": "上海陆家嘴万信R酒店",
          "titile": "在上海住到了宝藏酒店！太舒服了😌",
          "admin": { "fontcolor":"#ae6e15","color": "#fdefd2", "logo": "https://dimg04.c-ctrip.com/images/0AS64120009k1ouumABBE.png", "logoText": "https://dimg04.c-ctrip.com/images/0AS2z120009k1p6py8436.png", "bgImage": "https://dimg04.c-ctrip.com/images/0AS4u120009k1p2p9C257.png", "title": "4亿旅行者的口碑之选" },
          "userinfo": {}
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me1k12000elzaytj5ACD_R_640_10000_Q90.jpg",
          "images":[
            "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
            "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
            "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
            "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg"
          ],
          "type": "Video",
          "position": "上海陆家嘴万信R酒店",
          "titile": "在上海住到了宝藏酒店！太舒服了😌",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/0Z80m12000dz4wiyi2D0D_C_180_180.jpg", "username": "星仔体验酒店", "goods": "1984" }
        },
        {
          "systemType": "admin",
          "image": "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
          "images":[
            "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
            "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
            "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
            "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg"
          ],
          "type": "play",
          "position": "海昌海洋公园",
          "titile": "海昌海洋公园",
          "admin": { "fontcolor":"#1c8debe0","color": "skyblue", "logo": "https://dimg04.c-ctrip.com/images/0AS2b120009eaj4qkFDA1.png", "logoText": "https://dimg04.c-ctrip.com/images/0AS56120009eaj7zs183E.png", "bgImage": "https://dimg04.c-ctrip.com/images/0AS2v120009eainsa328F.png", "title": "特价好货低价抢" },
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/0Z80m12000dz4wiyi2D0D_C_180_180.jpg", "username": "星仔体验酒店", "goods": "1984" }
        },
        {
          "systemType": "admin",
          "image": "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg",
          "images":[
            "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
            "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
            "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
            "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg"
          ],
          "type": "images",
          "position": "上海陆家嘴万信R酒店",
          "titile": "在上海住到了宝藏酒店！太舒服了😌",
          "admin": { "fontcolor":"red","color": "pink", "logo": "https://dimg04.c-ctrip.com/images/0AS4n120009eainsc98AB.png", "logoText": "https://dimg04.c-ctrip.com/images/0AS6m120009eaj47c0D49.png", "bgImage": "https://dimg04.c-ctrip.com/images/0AS4p120009eair3bE29D.png", "title": "特价好货低价抢" },
          "userinfo": {}
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
          "type": "Video",
          "position": "上海",
          "titile": "太意外！在上海也能住上人均100的民宿 ！！！太意外了",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg", "username": "喵喵～爱旅行", "goods": "184" }
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me5x12000ejlvumzF8F4_R_640_10000_Q90.jpg",
          "type": "images",
          "images":[
            "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
            "https://dimg02.c-ctrip.com/images/1ml0412000d0y0o4iEDDF.jpg",
            "https://dimg04.c-ctrip.com/images/1me1m12000emtpmkt8932.jpg",
            "https://dimg04.c-ctrip.com/images/1me3412000ejv9ss58CAB_R_640_10000_Q90.jpg"
          ],
          "position": "上海外滩雅致酒店",
          "titile": "这家距离外滩步行仅10分钟的酒店好住不贵",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/0Z82x12000b1ua1woBE42_C_180_180.jpg", "username": "魔都闹闹", "goods": "126" }
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me2912000eiiwys647DA_R_640_10000_Q90.jpg",
          "type": "images",
          "position": "OPARTMENT远东饭店",
          "titile": "这家上海酒店推荐|位置绝佳的法式风酒店公寓距离外滩步行仅10分钟的酒店好住不贵",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/1h61g12000e2nwxam8989_C_180_180.jpg", "username": "君寻远", "goods": "82" }
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
          "type": "images",
          "position": "馋三尺蟹粉小笼(南京东路店)",
          "titile": "来自于上海本地人的推荐｜必吃榜上的蟹粉小笼",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/0Z82x12000b1ua1woBE42_C_180_180.jpg", "username": "linda小铃铛", "goods": "53" }
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me2912000eiiwys647DA_R_640_10000_Q90.jpg",
          "type": "images",
          "position": "OPARTMENT远东饭店",
          "titile": "这家上海酒店推荐|位置绝佳的法式风酒店公寓距离外滩步行仅10分钟的酒店好住不贵",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/1h61g12000e2nwxam8989_C_180_180.jpg", "username": "君寻远", "goods": "82" }
        },
        {
          "systemType": "user",
          "image": "https://dimg04.c-ctrip.com/images/1me4t12000em0aq640C60_R_640_10000_Q90.jpg",
          "type": "images",
          "position": "馋三尺蟹粉小笼(南京东路店)",
          "titile": "来自于上海本地人的推荐｜必吃榜上的蟹粉小笼",
          "admin": {},
          "userinfo": { "userImage": "https://dimg04.c-ctrip.com/images/0Z82x12000b1ua1woBE42_C_180_180.jpg", "username": "linda小铃铛", "goods": "53" }
        },
      ]
    },
    bindTimeChange: function(e) {
      console.log('picker发送选择改变，携带值为', e.detail.value)
      this.setData({
        time: e.detail.value
      })
    },
    active: function(e) {
      let index = e.currentTarget.dataset.index;
      this.setData({
        default: index,
        activeLeft: index >= 3 ? 200 : 0 /* 假设的滚动左偏移量，视情况调整 */
      });
    },
    imgs: function(e) {
        // 切换图片索引
        let currentIndex = this.data.currentImgIndex;
        let nextIndex = (currentIndex + 1) % this.data.img.length;
        // 切换 LogsShowType 状态
        let newLogsShowType = !this.data.LogsShowType;
        this.setData({
          currentImgIndex: nextIndex,
          LogsShowType: newLogsShowType
        });
      },
    
      // 切换 LogsShowType 状态的方法，示例函数
      toggleLogsShowType: function() {
        this.setData({
          LogsShowType: !this.data.LogsShowType
        });
      },
      navigateToDetail(e) {
        // 获取点击的图片的下标
        const index = e.currentTarget.dataset.index;
        // 通过 wx.navigateTo 跳转到详情页，并传递下标参数
        wx.navigateTo({
          url: `/pages/shequ/shequ?index=${index}`
        });
        console.log(index)
      },
    
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
  
    },
  
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {
  
    },
  
    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
  
    },
  
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {
  
    },
  
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {
  
    },
  
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {
  
    },
  
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
        wx.showLoading({
            title:"正在加载"
        });
        setTimeout(()=>{
            let pageindex=this.data.pagedefault;
            if(pageindex*4>=this.data.logsItem.length){
                wx.showModal({
                    title:'提示',
                    content:'已经没有更多内容',
                    showCancel:false
                });
                this.setData({
                    isGoBottom:true
                })
            }else{
                this.setData({
                    pagedefault:pageindex+1
                });
            }
            wx.hideLoading();
        },2000)
      },
  
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {
  
    }
  })